package sc.test;

import java.io.IOException;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.FloatWritable;
import org.apache.hadoop.io.SequenceFile;
import org.apache.hadoop.io.SequenceFile.Writer;
import org.apache.hadoop.io.Text;

import sc.writable.WritableArrayListFloat;


public class CreateSequenceFile {

	/**
	 * @param args
	 * @throws IOException 
	 */
	public static void main(String[] args) throws IOException {
		
		Configuration conf = new Configuration();
		Writer seqWriter =
			SequenceFile.createWriter(FileSystem.get(conf), conf, new Path("data/intArrayList.seq"), Text.class, WritableArrayListFloat.class);
	
		WritableArrayListFloat walf = new WritableArrayListFloat();
		walf.add(new FloatWritable(10.34f));
		walf.add(new FloatWritable(10.38f));
		walf.add(new FloatWritable(10.46f));
		walf.add(new FloatWritable(10.20f));
		walf.add(new FloatWritable(10.06f));
		walf.add(new FloatWritable(10.31f));
		walf.add(new FloatWritable(10.56f));
		walf.add(new FloatWritable(10.56f));
		walf.add(new FloatWritable(10.61f));
		walf.add(new FloatWritable(10.10f));
		walf.add(new FloatWritable(11.05f));
		seqWriter.append(new Text("test"), walf);
		seqWriter.close();
	}

}
